//! Build script for AI Test Platform

use std::env;

fn main() {
    // Set build-time environment variables
    let build_time = std::process::Command::new("date")
        .arg("/t")
        .output()
        .map(|output| String::from_utf8_lossy(&output.stdout).trim().to_string())
        .unwrap_or_else(|_| "unknown".to_string());

    println!("cargo:rustc-env=BUILD_TIME={}", build_time);

    let rustc_version = env::var("RUSTC_VERSION")
        .or_else(|_| {
            std::process::Command::new("rustc")
                .arg("--version")
                .output()
                .map(|output| String::from_utf8_lossy(&output.stdout).trim().to_string())
        })
        .unwrap_or_else(|_| "unknown".to_string());

    println!("cargo:rustc-env=RUSTC_VERSION={}", rustc_version);

    // Re-run if build script changes
    println!("cargo:rerun-if-changed=build.rs");
}
